Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only reject air for pathfinding bounds, not pathable tiles without floors #65720

Merged
merged 1 commit into from
May 20, 2023

Conversation

RenechCDDA
Copy link
Member

Summary

Bugfixes "Stairs doesn't block pathfinding for some purposes (e.g. crafting pickup range)"

Purpose of change

Describe the solution

map::has_floor_or_support always returns false if going downwards is a valid move. Going downwards on stairs is a valid move, but not the only move. Therefore we need to check something more sane, like map::is_open_air.

There shouldn't be any scenarios where you can go downwards (map::has_floor_or_support returns true) that doesn't also return true for map::is_open_air, except for stairs.

Describe alternatives you've considered

I originally did this by checking map::passable and then realized that open air is, technically speaking, passable. Soooo that didn't work.

Testing

Compiled locally and confirmed I could find crafting components through the stairs. Debugged a new scenario(image below) where I was separated from components by air, confirmed I could not access them.

image

Additional context

map::has_floor_or_support is a very sussy name and a very sussy function.

This bug report came from 0.G so if this fix is acceptable it may be desirable to also backport it.

@github-actions github-actions bot added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` labels May 18, 2023
@GlitterLich
Copy link
Contributor

nice sleuthing!! well done! 🎉

@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels May 18, 2023
@Qrox
Copy link
Contributor

Qrox commented May 19, 2023

Sounds like this could fix #35665?

Edit: actually that issue is about going upstairs so I guess probably not...

@PatrikLundell
Copy link
Contributor

What about an underwater case where you'd have to check that it isn't open water rather than open air? I think I've seen something about supporting walking on the bottom of bodies of water for some kinds of mutants, for instance.

@RenechCDDA
Copy link
Member Author

These are rejection criteria so if anything being able to path across water is too permissive. The pickup range is only 6 tiles though and I cannot imagine any scenario where that actually comes into play.

@dseguin dseguin merged commit 7a6bfc0 into CleverRaven:master May 20, 2023
@RenechCDDA RenechCDDA deleted the pathfinding_stairs_fix branch May 21, 2023 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Down stairs block pathfinding for purposes of crafting reach
5 participants